package com.cskaoyan.javase.oop1._8review._1pvz;

/**
 * 僵尸类
 *  僵尸
 *     属性：血量，攻击力，名字，移动速度
 *     行为：移动，攻击，被攻击，吃脑子
 *
 * @since 11:05
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Zombie {
    int hp;
    int damage;
    String name;
    double moveSpeed;
    // 持有植物的引用
    Plant zombieP;

    public void move() {
        System.out.println(name + "以" + moveSpeed + "的速度，正在靠近" + zombieP.name);
    }

    public void attack() {
        System.out.println(name + "正在攻击: " + zombieP.name);
    }

    /**
     * 僵尸被植物攻击，返回剩余血量
     * @since 11:09
     * @return int 返回剩余血量
     * @author wuguidong@cskaoyan.onaliyun.com
     */
    public int beAttacked() {
        System.out.println(name + "正在被" + zombieP.name + "攻击");
        return this.hp - zombieP.damage;
    }

    public void eatUBrain() {
        System.out.println("僵尸吃掉了你的脑子，真香！");
    }

    // 构造器


    public Zombie() {
    }

    public Zombie(int hp, int damage, String name, double moveSpeed) {
        this.hp = hp;
        this.damage = damage;
        this.name = name;
        this.moveSpeed = moveSpeed;
    }
}
